<h3>Add User</h3>
<div class="body-con">
<form action="javascript:void(0)<?php //echo $this->form->getAction()?>" method="<?php echo $this->form->getMethod()?>" onsubmit="return checkexist()">

	<label>Username: </label> <?php echo $this->form->username; ?> <br />
	<label>Password: </label> <?php echo $this->form->password; ?> <br />
	<label>Real name: </label> <?php echo $this->form->realname; ?> <br />
	
	<?php echo $this->form->Add;?>

</form>
</div>

<script> 
(function($){
	checkexist = function(){
		$.ajax({
			'url':'add',
			'type':'post',
			'data':{'username':$('#username').val(), 'password': $('#password').val(), 'realname':$('#realname').val()},
			'success':function($data){
				if($data == 'true' ){
					alert('Tài khoản này đã bị trùng');
				}else if($data=='add_ok'){
					alert('Thêm thành công!');
					location.href="index";
				}
			}
		});
	};
})(jQuery);
</script>